#include "comm.hpp"

int main()
{
    // 获取共享内存
    int shmid = GetMem();
    log(Debug, "create sharemem done...");

    sleep(5);

    // 挂接共享内存
    char *shmaddr = (char*)shmat(shmid, nullptr, 0);
    log(Debug, "attach shm done, shmaddr: 0x%x", shmaddr);

    sleep(5);

    // ipc-code 通信代码
    while(true)
    {
        cout << "Please enter:";
        fgets(shmaddr, size, stdin);
    }

    // 去关联
    shmdt(shmaddr);
    log(Debug, "detach shm done, shmaddr: 0x%x", shmaddr);

    sleep(5);

    log(Debug, "processa quit...");
    return 0;
}
